perm filename WRITX[B2,JMC] blob sn#767858 filedate 1984-09-12 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	(setq varlist '(name arg then parameters ))
C00004 ENDMK
CāŠ—;
(setq varlist '(name arg then parameters ))
(defun isvar (x) (memq x varlist))
(defun sublis (p al)
  (if (atom p)
      (if (isvar p) 
          (let ((w (assoc p al)))  (if (null w) p (cdr w)))
          p)
      (cons (sublis (car p) al) (sublis (cdr p) al))))
;
(defun match (p e al) 
  (if (eq al 'NO)
      'no
      (if (atom p)
          (if (isvar p)
              (let ((w (assoc p al))) (if (null w)
                                         (cons (cons p e) al)
                                         (if (equal (cdr w) e)
                                             al
                                             'no)))
              (if (eq p e) al 'no))
          (if (atom e)
              'no
              (match (cdr p)
                     (cdr e)
                     (match (car p) (car e) al))))))

(match
'(defun name (arg parameters) (if (atom arg) then (name (car arg) (name (cdr arg) parameters))))

'(defun flat (x y) (if (atom x) (cons x y) (flat (car  x)(flat (cdr x) y))))

nil)
((THEN CONS X Y) (PARAMETERS . Y) (ARG . X) (NAME . FLAT))